package com.yydream.dto;

import com.yydream.common.valid.AddGroup;
import com.yydream.common.valid.ListValue;
import com.yydream.common.valid.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

@Data
public class SysMenuDTO extends BaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(name = "菜单id",notes = "")
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    private Long id ;

    @ApiModelProperty(name = "菜单父级id",notes = "")
    private Long pid ;

    @ApiModelProperty(name = "菜单名称",notes = "")
    @NotEmpty(message = "菜单名称不能为空", groups = {AddGroup.class})
    private String name ;

    @ApiModelProperty(name = "菜单编码",notes = "")
    @NotEmpty(message = "菜单编码不能为空", groups = {AddGroup.class})
    private String code ;

    @ApiModelProperty(name = "菜单地址",notes = "")
    private String path ;

    @ApiModelProperty(name = "菜单图标",notes = "")
    private String icon ;

    @ApiModelProperty(name = "组件地址",notes = "")
    private String component ;

    @ApiModelProperty(name = "开启缓存",notes = "（1：开启，2：关闭）")
    private Integer keepAlive ;

    @ApiModelProperty(name = "权限码",notes = "")
    @NotEmpty(message = "权限码不能为空", groups = {AddGroup.class})
    private String permission ;

    @ApiModelProperty(name = "动态路由添加层级",notes = " (默认值为layer，应附加“Route”的父路由记录，这里对应的是父级路由的code)")
    @NotNull(message = "动态路由添加层级不能为空", groups = {AddGroup.class})
    private String routerViewName ;

    @ApiModelProperty(name = "是否显示到顶部菜单",notes = "（1: 显示，2：不显示）")
    @NotNull(message = "是否显示到顶部菜单不能为空", groups = {AddGroup.class})
    @ListValue(value = {1, 2}, message = "是否显示到顶部菜单只能是：（1：显示，2：不显示）", groups = { AddGroup.class, UpdateGroup.class})
    private Integer isShow ;

    @ApiModelProperty(name = "菜单状态",notes = "（1：启动，2：禁用）")
    @NotNull(message = "状态不能为空", groups = {AddGroup.class})
    @ListValue(value = {1, 2}, message = "状态只能是：（1：启动，2：禁用）", groups = { AddGroup.class, UpdateGroup.class})
    private Integer state ;

    @ApiModelProperty(name = "排序",notes = "")
    private Integer sort ;

    @ApiModelProperty(name="直属子集菜单", notes = "")
    private List<SysMenuDTO> childMenus;
}
